//package com.ly.publisher.config;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.ReturnedMessage;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.BeansException;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.ApplicationContextAware;
//import org.springframework.context.annotation.Configuration;
//
//@Slf4j
//@Configuration
//public class MqConifrmConfig implements ApplicationContextAware {
//    @Override
//    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
//        RabbitTemplate rabbitTemplate = applicationContext.getBean(RabbitTemplate.class);
//        //配置回调
//        rabbitTemplate.setReturnsCallback(new RabbitTemplate.ReturnsCallback(){
//
//            @Override
//            public void returnedMessage(ReturnedMessage returned) {
//                log.debug("收到消息的retrun callback,exchange:{},key:{},code:{},text:{}",
//                        returned.getExchange(),
//                        returned.getRoutingKey(),
//                        returned.getMessage(),
//                        returned.getReplyCode(),
//                        returned.getReplyText()
//                );
//            }
//        });
//    }
//}
